import React, { Component } from 'react';
import Search from './components/Search'
import List from './components/List'
class App extends Component{
  state = {
    userData: [], 
    isFirst: true, //是否第一次打开页面
    isLoading: false, //是否处于加载状态，接口还没返回数据
    err: '', //存储接口返回的错误信息
  }
  handleData = (items) => {
    console.log(items)
    this.setState({userData: items})
  }
  updateState = (state) => {
    this.setState(state)
  }
  render(){
    let {userData} = this.state
    return (
      <div className="container">
        <Search handleData={this.handleData} updateState={this.updateState}/>
        <List userData={userData} {...this.state}/>
      </div>
    )
  } 
}

export default App;
